package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Liangyaoyun
 */
public class leetCode78 {
    public List<Integer>path=new ArrayList<>();
    public List<List<Integer>>result=new ArrayList<>();

    public List<List<Integer>>subsets(int[] nums){
        dfs(nums,0);
        return result;
    }
    public void dfs(int[] nums,int i){
        if (i== nums.length){
            result.add(new ArrayList<>(path));
            return;
        }
        path.add(nums[i]);
        dfs(nums,i+1);

        path.remove(path.size()-1);
        dfs(nums,i+1);

    }

}
